package com.foodplus.www.presenter;

import com.foodplus.www.api.BaseSubscriber;
import com.foodplus.www.api.ExceptionHandle;
import com.foodplus.www.bean.good.GoodBean;
import com.foodplus.www.model.impl.GoodModelImpl;
import com.foodplus.www.view.impl.GoodView;

import java.util.Map;

/**
 * Created by WangZhiChao on 2016/10/31.
 */

public class GoodPresenter {

    GoodView view;

    public GoodPresenter(GoodView view) {
        this.view = view;
    }

    public void getGoodsData( Map<String, String> params) {
        new GoodModelImpl().getGoodData(new BaseSubscriber<GoodBean>() {
            @Override
            public void onSuccess(GoodBean goodBean) {
                view.onSuccess(goodBean);
            }

            @Override
            public void onFail(ExceptionHandle.ResponeThrowable e) {
                view.onFail(e);
            }

            @Override
            public void onFinished() {
                view.onFinish();
            }
        }, params);
    }
}
